package chapter_12_flyweight.classic;

/**
 * Created by CharloYao on 2017/10/13.
 */
public class Client {

    public static void main(String[] args) {
        //获取一个外部状态为extrinsic1的对象
        Flyweight flyweight = FlyweightFactory.getFlyweight("extrinsic1");
        //设置内部状态为intrinsic1
        flyweight.setIntrinsic("intrinsic1");
        //执行业务逻辑
        flyweight.operation();

        //获取一个外部状态为extrinsic2的对象
        flyweight = FlyweightFactory.getFlyweight("extrinsic2");
        //设置内部状态为intrinsic2
        flyweight.setIntrinsic("intrinsic2");
        //执行业务逻辑
        flyweight.operation();
    }

}
